{% extends "base.html" %}
{% from "macros/macro_pagination.html" import render_pagination %}

{% block title %}
    系统日志
{% endblock %}

{% block page_title %}
    系统日志列表
{% endblock %}


{% block body %}
    <!-- 搜索区域 -->
    <form id="queryForm" method="post" action="{{ url_for('system_log.page') }}">
        {{ form.csrf_token }}
        <div class="search-container">
            <div class="search-form">
                {% for field in form %}
                    {% if field.type == "CSRFTokenField" %}
                        {{ "" }}
                    {% else %}
                        <div class="condition">
                            <label>{{ field.label }}</label>
                            <div class="filter-input">
                                {{ field() }}
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            </div>
            <div class="condition-more">
                <div class="condition" style="margin-right: 0;">
                    <button class="search-button" type="submit">
                        <i class="fa fa-search"></i>查询
                    </button>
                    <button class="reset-button" type="button" onclick="clearForm()">
                        <i class="fas fa-times"></i>重置
                    </button>
                </div>
            </div>

        </div>
    </form>

    <!-- 数据列表 -->
    <div class="data-table-container">
        <table class="data-table">
            <thead>
            <tr>
                <th>ID</th>
                <th>操作模块</th>
                <th>操作人</th>
                <th>创建时间</th>
            </tr>
            </thead>
            <tbody>
            {% for item in pagination.items %}
                <tr>
                    <td>{{ item.get('id') }}</td>
                    <td>{{ item.get('module_name') }}</td>
                    <td>{{ item.get('operator_name') }}</td>
                    <td>{{ item.get('create_time') }}</td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
    <!-- 分页控件 -->
    {{ render_pagination(pagination, 'system_log.page', form=form) }}

{% endblock %}